<?php
namespace backend\models\download;

use yii\base\Model;
use yii\web\UploadedFile;

class UploadForm extends Model
{
    /**
     * @var UploadedFile
     */
    public $imageFile;

    public function rules()
    {
        return [
            [['imageFile'], 'file', 'extensions' => 'rar,zip,cab,arj,png,jpg'],
        ];
    }
    
    public function upload()
    {
            if($this->validate()){
            $this->imageFile->saveAs('../uploads/soft/' . $this->imageFile->baseName . '.' . $this->imageFile->extension);
            return true;
            }else{
                return false;
            }
    
    }

	/**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'imageFile' => '选择软件',            
        ];
    }
}